/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.chl.hajo.sshop;
import edu.chl.hajo.shop.core.Product;
import java.util.logging.Logger;
import java.util.logging.Level;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * Web application lifecycle listener.
 *
 * @author Joel
 */
@WebListener()
public class SessionListener implements HttpSessionListener {

    @Override
    public void sessionCreated(HttpSessionEvent se) {
    Logger.getAnonymousLogger().log(Level.INFO, "Created session");    
    se.getSession().setAttribute(Keys.PRODUCT_LIST.toString(), new ContainerNavigator<>(0,3,Shop.INSTANCE.getProductCatalogue()));
    
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
            Logger.getAnonymousLogger().log(Level.INFO, "Destroyed Session");    
      }
}
